#pragma once

#include "Defines.h"
#include "SnakeVector.h"
#include "SnakeSegment.h"
#include "Nugget.h"
#include "cli.h"
#include <iostream>
#include <conio.h>

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

using namespace std;

class Game
{
private:
	SnakeVector<SnakeSegment> snake;
	SnakeVector<Nugget> treasure;
	int m_input;
	int m_updateRate, m_updateTimer, m_age;
	int m_lastTreasureSpawn;
	int m_mapWidth, m_mapHeight, m_mapArea;
	int m_oldTailX, m_oldTailY;
	int m_score;
	int m_scoreInc;
	char ** m_map;
	bool playerWantsToQuit;
public:
	Game();
	void setup();
	int selectMapSize();
	void print(SnakeSegment &piece);
	void printAll();
	void add();
	int move(int segmentNo, int dirOfPrevSegment);
	void moveAll();
	void initDraw();
	void draw();
	bool handleInput(int input);
	void update(int a_ms);
	int updateRate() {return m_updateRate;}
	void processInput();
	bool lethalCollisionCheck();
	bool doesPlayerWantToQuit() {return playerWantsToQuit;}
	void generateTreasure();
	void treasureCollision();
	void increaseScore(int a_inc) {m_score += a_inc;}
	void gameOver();
	void thanks();
	void release();
	~Game();
};
